package com.tyl.state;

public class Stop1 implements Runnable {

    //票数
    private  int tickename=10;
    @Override
    public void run() {
        while (true){
            if(tickename<=0){
                break;
            }
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"拿到了第"+tickename--+"张票");
        }
    }

    public static void main(String[] args) {
        Stop1 ticke=new Stop1();
        new Thread(ticke,"小明").start();
        new Thread(ticke,"黄牛").start();
        new Thread(ticke,"老师").start();
    }
}
